package com.class3.team.fossilProject.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONArray;
import com.class3.team.fossilProject.service.BookService;

@CrossOrigin
@RestController
@RequestMapping("/searchtree")
public class SearchTreeController {
	
	@Autowired
	private BookService bookService;
	
	@GetMapping("/{name}")
	@ResponseBody
	public JSONArray getElementByName(@PathVariable String name) {
		System.out.println("!!!!!!!!!!!YES!!!!!!!!!!!!");
		JSONArray res = bookService.getJAByEleName(name);
		System.out.println(res.size()+"!!!!!!!!!!!1");
		return res;
	}
	
}









